//
//  CustomImgView.m
//  yigou
//
//  Created by SunChao on 17/2/6.
//  Copyright © 2017年 hanyiwang. All rights reserved.
//

#import "CustomImgView.h"

#define imgWidth 90
#define imgHeight 90
#define imgSpace 7

@implementation CustomImgView

- (id)init{
    self = [super init];
    if(self)
    {
        
        self.backgroundColor = [UIColor whiteColor];
        self.img = [UIImageView new];
        self.img.frame = CGRectMake(0, 0, imgWidth, imgHeight);
        self.img.layer.cornerRadius = 8;
        self.img.layer.masksToBounds = YES;
        [self addSubview:_img];
        UIView *view = [[UIView alloc]initWithFrame:self.img.frame];
        view.backgroundColor = [UIColor blackColor];
        view.alpha = 0.3;
        view.layer.cornerRadius = 8;
        view.layer.masksToBounds = YES;
        [self addSubview:view];
        self.title = [UILabel new];
        [self addSubview:_title];
        [_title setFont:[UIFont fontWithName:@"Helvetica-Bold" size:14]];
        _title.textColor = [UIColor blackColor];
        _title.textAlignment = NSTextAlignmentCenter;
        float x = self.img.frame.origin.x;
        float y = self.img.frame.origin.y + self.img.frame.size.height +5;
        float w = self.img.frame.size.width;
        float h = 20;
//        _title.backgroundColor = [UIColor redColor];
        _title.frame = CGRectMake(x, y , w, h);

    }
    return self;
}

@end
